home *** CD-ROM | disk | FTP | other *** search
- #include <genstub.c>
-
- void NameClipFormat( UINT uFormat, char *cName );
-
- LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
- {
- switch (uMsg) /* process windows messages */
- {
- case WM_COMMAND: /* process menu items */
- switch (LOWORD(wParam))
- {
- case IDM_TEST:
- { // User hit the "Test" menu item
- int i;
- int nCBFormats;
- HDC hDC = GetDC( hWnd );
- nCBFormats = CountClipboardFormats( );
- OpenClipboard( hWnd );
- for (i = 0 ; i < nCBFormats ; i++)
- {
- char cBuf [128];
- char cName [64];
- UINT uFormat = EnumClipboardFormats( uFormat );
- // We know we have a valid format because we used
- // CountClipboardFormats to return number of formats.
- NameClipFormat( uFormat, cName );
- TextOut( hDC, 10, i * 20, cBuf,
- wsprintf( cBuf, "%s, ( 0x%x ) clipboard format available.",
- (LPSTR) cName, uFormat) );
- }
- CloseClipboard( );
- ReleaseDC( hWnd, hDC );
- break ;
- }
- case IDM_EXIT:
- DestroyWindow( hWnd );
- break;
- #include <aboutopt.c>
-
- }
- break;
- case WM_DESTROY:
- PostQuitMessage( 0 );
- break ;
-
- // right button mouse interface
-
- #include <rbutton.c>
-
- default:
- return DefWindowProc( hWnd, uMsg, wParam, lParam );
- }
- return (0L) ;
- }
-
- /* fills in cName with name of a clipboard format */
-
- #ifdef WINDOWS95
- #define PREDEFINED_CLIPBOARD_FORMAT_COUNT 17
- #else
- #define PREDEFINED_CLIPBOARD_FORMAT_COUNT 14
- #endif
-
- void NameClipFormat (UINT uFormat, char *cName)
- {
- static char *cClipName [PREDEFINED_CLIPBOARD_FORMAT_COUNT + 1] =
- {"CF_FIRST", "CF_TEXT", "CF_BITMAP",
- "CF_METAFILEPICT", "CF_SYLK", "CF_DIF", "CF_TIFF",
- "CF_OEMTEXT", "CF_DIB", "CF_PALETTE" , "CF_PENDATA", "CF_RIFF",
- "CF_WAVE", "CF_UNICODETEXT", "CF_ENHMETAFILE"
- #ifdef WINDOWS95
- , "HDROP", "LOCALE", "MAX" // not available in NT or Win32s
- #endif
- };
-
- static char *cClipName2 [4] =
- {"CF_OWNERDISPLAY", "CF_DSPTEXT", "CF_DSPBITMAP", "CF_DSPMETAFILEPICT"};
-
- int nLengthFormatName = GetClipboardFormatName( uFormat, cName, 63 );
-
- if (nLengthFormatName == 0) {
- /* predefined format */
- if (uFormat <= PREDEFINED_CLIPBOARD_FORMAT_COUNT)
- lstrcpy( cName, cClipName[uFormat - CF_FIRST] );
- else if ((uFormat <= CF_DSPMETAFILEPICT) && (uFormat >= CF_OWNERDISPLAY))
- lstrcpy( cName, cClipName2[uFormat - CF_OWNERDISPLAY] );
- else if (uFormat==0x8e)
- lstrcpy( cName, "CF_DSPENHMETAFILE" );
- else if (uFormat>=0x300 && uFormat<=0x3ff)
- wsprintf( cName, "CF_GDIOBJFIRST+%d", uFormat-CF_GDIOBJFIRST );
- else
- strcpy( cName, "<Not named>" );
- }
-
- }
-
- #include <about.c>
-